<%-- 
    Document   : quitar
    Created on : 23/05/2011, 12:33:05 AM
    Author     : Robert
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="javax.jdo.PersistenceManager" %>
<%@ page import="Usuarios.Usuario" %>
<%@ page import="Libros.PMF" %>
<%@ page import="Libros.Libro" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.Vector" %>
<%@ page session="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<%
     HttpSession sesionOk = request.getSession();
     String cod = (String)request.getParameter("id");
     int indice;
     Vector<Libro> libros = (Vector<Libro>)sesionOk.getAttribute("carrito");
     if(!libros.isEmpty()){
         for(int i=0;i<libros.size();i++){
             Libro L = (Libro)libros.get(i);
             if(L.getCodigo().equals(cod))
             {
                 libros.remove(i);break;
             }
         }
        sesionOk.setAttribute("carrito",libros);   
        response.sendRedirect("micarrito.jsp");
     }  
%>